var express = require('express')
var path = require('path')
var bodyParser = require('body-parser')

var port = process.env.PORT||2333;
var app = express()

app.set('views','./app/views/pages');
app.set('view engine','jade');
app.use(bodyParser.urlencoded());
app.use(express.static(path.join(__dirname,'public')));

if('development' === app.get('env')){
	app.set('showStackError',true)
	app.use(express.logger(':method :url :status'))
	app.locals.pretty = true
	// mongoose.set('debug',true)
}

require('./config/routes')(app)

app.listen(port);
console.log('   :) App started successfully on port '+ port);